// import {GlobalVariables} from '../GlobalVariables';
import {global} from '../Main';
import {BaseScene} from 'BaseScene';
export class Room1 extends BaseScene{
    // public advancedTexture = BABYLON.GUI.AdvancedDynamicTexture.CreateFullscreenUI("UI");
    /**
     * 只需要实现此方法，将playground的代码粘贴到此方法即可;
     * @returns
     */
    public iniScene(){
        //注意添加这两行，以匹配playground里的代码
        var engine = global.engine;
        var canvas = global.canvas;
        var scene = this.scene;
        var THIS = this;
        
        // var camera = new BABYLON.ArcRotateCamera("arc1", -Math.PI / 4, Math.PI / 4, 40, BABYLON.Vector3.Zero(), scene);
        var camera = new BABYLON.UniversalCamera("camera", new BABYLON.Vector3(4,0,0), scene);
        camera.speed = 3;
        camera.inertia = 0;
        
        camera.attachControl(canvas, true);

        BABYLON.SceneLoader.ImportMesh("", "glb/", "untitled.babylon", scene, function (newMeshes) {
            // Set the target of the camera to the first imported mesh
            scene.createDefaultLight();

            camera.setTarget(scene.getMeshByID('Cube').position);
        }.bind(this));



        scene.gravity = new BABYLON.Vector3(0, -0.01, 0);
        camera.applyGravity = true;
        camera.checkCollisions = true;
        // @ts-ignore   
        camera._needMoveForGravity = true;  //解决不移动的时候掉落停止的问题，此处报错忽略即可
        
    }
}